/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Business;

import java.util.List;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author anhvtn_b00545
 */
public class loadOrderDetails extends AbstractTableModel{

    private int column= 4;
    private List<BillDetails_BS> list;

    public loadOrderDetails(List<BillDetails_BS> list) {
        this.list = list;
    }

    public int getRowCount() {
       return list.size();
    }

    public int getColumnCount() {
        return column;
    }
@Override
    public String getColumnName(int column) {
        switch(column) {
            case 0 : return "Product Name";
            case 1 : return "Sell Price";
            case 2 : return "Quantity";
            case 3: return "Subtotal";

        }
        return null;
    }
    public Object getValueAt(int rowIndex, int columnIndex) {
        BillDetails_BS bd = list.get(rowIndex);
        switch(columnIndex) {
            case 0 : return bd.getPName();
            case 1 : return bd.getBdSellPrice();
            case 2 : return bd.getBdQuantity();
            case 3 : return (bd.getBdSellPrice() * bd.getBdQuantity());
        }
        return null;
    }
}
